From: Sebastian Wick Date: Wed, 25 Jun 2025 11:15:24 +0000 (+0200) Subject: Adjust to cursor tracker visibility API changes X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~124^2^2~24 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=91c6366e0199eacfb62787ba669bd90fefd6c6d9;p=gnome-shell.git Adjust to cursor tracker visibility API changes The old `Meta.CursorTracker.set_pointer_visible` method has been replaced by `inhibit_cursor_visibility` and `uninhibit_cursor_visibility`. Change the code to use the new API which makes the code more robust because we don't have to listen for changes and then try to force it back to what we want. Part-of: --- diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 3b5c011a7..386a8071c 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -137,11 +137,9 @@ export class Magnifier extends Signals.EventEmitter { this._cursorUnfocusInhibited = false; } - if (this._cursorVisibilityChangedId) { - this._cursorTracker.disconnect(this._cursorVisibilityChangedId); - delete this._cursorVisibilityChangedId; - - this._cursorTracker.set_pointer_visible(true); + if (this._cursorVisibleInhibited) { + this._cursorTracker.uninhibit_cursor_visibility(); + this._cursorVisibleInhibited = false; } } @@ -155,12 +153,9 @@ export class Magnifier extends Signals.EventEmitter { this._cursorUnfocusInhibited = true; } - if (!this._cursorVisibilityChangedId) { - this._cursorTracker.set_pointer_visible(false); - this._cursorVisibilityChangedId = this._cursorTracker.connect('visibility-changed', () => { - if (this._cursorTracker.get_pointer_visible()) - this._cursorTracker.set_pointer_visible(false); - }); + if (!this._cursorVisibleInhibited) { + this._cursorTracker.inhibit_cursor_visibility(); + this._cursorVisibleInhibited = true; } } diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 8867239d3..0ee1ce284 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -369,7 +369,10 @@ export class ScreenShield extends Signals.EventEmitter { } _showPointer() { - this._cursorTracker.set_pointer_visible(true); + if (this._cursorVisibleInhibited) { + this._cursorTracker.uninhibit_cursor_visibility(); + this._cursorVisibleInhibited = false; + } if (this._motionId) { global.stage.disconnect(this._motionId); @@ -377,6 +380,13 @@ export class ScreenShield extends Signals.EventEmitter { } } + _hidePointer() { + if (!this._cursorVisibleInhibited) { + this._cursorTracker.inhibit_cursor_visibility(); + this._cursorVisibleInhibited = true; + } + } + _hidePointerUntilMotion() { this._motionId = global.stage.connect('captured-event', (stage, event) => { if (event.type() === Clutter.EventType.MOTION) @@ -384,7 +394,7 @@ export class ScreenShield extends Signals.EventEmitter { return Clutter.EVENT_PROPAGATE; }); - this._cursorTracker.set_pointer_visible(false); + this._hidePointer(); } _hideLockScreen(animate) {